package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    private AddressContainer aCon;

    public AddressCtr()
    {
        aCon = aCon.getInstance();
    }
    
    public int listSize()
    {
        int size = aCon.listSize();
        return size;
    }
    
      /**
     * This method will take Strings as input to find a Person. It does this by using a search pattern
     * 
     * @ return     This method will return a datatype of the type Person
     */
    public Person findPerson(String phone)
    {
        return aCon.findPerson(phone);
    }
    
    public void addPerson(String name, String lastName, String phone, String address, String zip, String city)
    {   
        aCon.addPerson(name, lastName, phone, address, zip, city);
    }
    
    public void deletePerson(String phone)
    {
        aCon.deletePersonByPhone(phone);
    }
    
    public void updatePersonName(String phone, String name, String newName)
    {
        aCon.updatePersonName(phone, name, newName);
    }
    
    public void updatePersonLastName(String phone, String lastName, String newLastName)
    {
        aCon.updatePersonLastName(phone, lastName, newLastName);
    }
    
    public void updatePersonPhone(String phone, String newPhone)
    {
        aCon.updatePersonPhone(phone, newPhone);
    }
    
    public void updatePersonAddress(String phone, String address, String newAddress)
    {
        aCon.updatePersonAddress(phone, address, newAddress);
    }
    
    public void updatePersonZip(String phone, String zip, String newZip)
    {
        aCon.updatePersonZip(phone, zip, newZip);
    }
    
    public void updatePersonCity(String phone, String city, String newCity)
    {
        aCon.updatePersonCity(phone, city, newCity);
    }
    
    public void listAllPersons()
    {        
        aCon.listAllPersons();
    }
}
